﻿/// <reference path="../../release/ajaxstack-core.js"/>
/// <reference path="../../release/jsApp.js"/>

function ExamplesContext(app, gateway)
{
	ExamplesContext.$baseConstructor.call(this, app, gateway);
}
ExamplesContext.extend(ContextBase, { type: 'ExamplesContext' },
{
	getFactorial: function(forNumber)
	{
		var request = this.createRequest({ ForNumber: forNumber });

		var $this = this;
		this.gateway.getFromJsonService("GetFactorial", request, function(e)
		{
			$this.dispatchEvent('onGetFactorial', this, e);
		});
	},

	getFibonacciNumbers: function(skip, take)
	{
		var request = this.createRequest({ Skip: skip, Take: take });

		var $this = this;
		this.gateway.getFromJsonService("GetFibonacciNumbers", request, function(e)
		{
			$this.dispatchEvent('onGetFibonacciNumbers', this, e);
		});
	}
});